class Solution {
public:
    long long getDescentPeriods(vector<int>& prices)
    {
        int n = prices.size();
        if (n == 0)
            return 0;
        vector<long long> dp(n,1);
        long long res = 1;
        for (int i = 1; i < prices.size(); ++i)
        {
            if (prices[i - 1] - prices[i] == 1)
            {
                dp[i] += dp[i - 1];
            }
            res += dp[i];
        }
        
        return res;
    }
};
